package stars.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum EStarType {

	/*
	 * min/max lum, 
	 * min/max temp, (K)
	 * min/max mass, (Msun)
	 * min/max radius, (Rsun)
	 * min/max rotation, (rad/sec)
	 * min/max mag field, (Gauss)
	 * index, 
	 * binary, trinary, quad multi-system probabilities
	 * 
	 */
	
	/*SUBDWARF (300.0, 10000.0,
	20000.0, 40000.0,
	0.45, 0.55,
	0.15, 0.25,
	0.5, 0.7,
	200.0, 10000.0),  //O and B.  http://en.wikipedia.org/wiki/Subdwarf_star
	
	//J.F. Donati and J.D. Landstreet (2009) for default mag fields (200 - 10000)*/
	DWARF_WHITE (
			0,
			0.0001, 10,
			4000, 52000,
			0.05, 1.4,
			0.003, 0.036,
			0.5, 0.7,
			0.0, 10.0,
			0.3, 0.05, 0.01),			
			//http://en.wikipedia.org/wiki/White_dwarf
			//http://en.wikipedia.org/wiki/Main_sequence
	MS_BLUE (
			1,
			30000.0, 1000000.0,
			30000.0, 52000.0,
			19.02, 51.8,
			6.42, 12.36,
			0.0, 1.5*0.00001,
			200.0, 10000.0,
			0.6, 0.15, 0.05),  //http://www.space.com/1995-astronomers-wrong-stars-single.html
	MS_BLUEWHITE (
			2,
			16.0, 30000.0,
			10000.0, 30000.0,
			2.2, 19.01,
			1.33, 6.43,
			7.6*0.00001, 11.1*0.00001,
			200.0, 10000.0,
			0.6, 0.15, 0.05),
	MS_WHITE (
			3,
			3.0, 16.0,
			7600.0, 10000.0,
			1.36, 2.2,
			1.0, 1.33,
			13.0*0.00001, 18.0*0.00001,
			200.0, 10000.0,
			0.4, 0.08, 0.02),
	MS_YELLOWWHITE (
			4,
			1.5, 5.0,
			6000.0, 7600.0,
			1.12, 1.58,
			1.13, 1.30,
			3.0*0.00001, 10.0*0.00001,
			200.0, 10000.0,
			0.4, 0.08, 0.02),
	MS_YELLOW (
			5,
			0.5, 1.5,
			5200.0, 6000.0,
			0.82, 1.12,
			0.87, 1.13,
			0.1*0.00001, 3.0*0.00001,
			200.0, 10000.0,
			0.4, 0.08, 0.02),
	MS_ORANGE (
			6,
			0.09, 0.5,
			4000.0, 5200.0,
			0.5, 0.82,
			0.62, 0.87,
			0.05*0.00001, 0.1*0.00001,
			200.0, 10000.0,
			0.4, 0.08, 0.02),
	MS_RED (
			7,
			0.0002, 0.09,
			2000.0, 3900.0,
			0.087, 0.5,
			0.11, 0.66,
			0.01*0.00001, 0.05*0.00001,
			200.0, 10000.0,
			0.2, 0.04, 0.01),
	/*SUBGIANT (10.0, 1000.0,
			4500.0, 20000.0,
			0.7, 10.0,
			1.5, 10.0,
			1.0*0.00001, 2.0*0.00001,
			200.0, 10000.0),  //http://en.wikipedia.org/wiki/Subgiant*/
	GIANT (
			8,
			90.0, 1000.0,
			2500.0, 15000.0,
			0.1, 4.0,
			10.0, 100.0,
			1.0*0.00001, 2.0*0.00001,
			200.0, 10000.0,
			0.6, 0.15, 0.05),  
			//http://en.wikipedia.org/wiki/Giant_star
	SUPERGIANT (
			9,
			30000.0, 200000.0,
			2500.0, 35000.0,
			10.0, 70.1,
			30.0, 500.0,
			1.0*0.00001, 2.0*0.00001,
			200.0, 10000.0,
			0.6, 0.15, 0.05),  
			//http://en.wikipedia.org/wiki/Supergiant
	HYPERGIANT (
			10,
			200000.0, 8000000.0,
			3500.0, 35000.0,
			100.0, 265.0,
			35.0, 2000.0,
			1.0*0.00001, 2.0*0.00001,
			200.0, 10000.0,
			0.6, 0.15, 0.05), 
			//http://en.wikipedia.org/wiki/Hypergiant
	NEUTRON (
			11,
			0.000001, 0.000001,
			800000.0, 1200000.0,
			1.35, 2.0,
			0.000016, 0.000018,
			0.0, 6300.0,
			Math.pow(10, 12), 10000*Math.pow(10,12),
			0.05, 0.01, 0.0), 
			//http://en.wikipedia.org/wiki/Neutron_star
	BLACKHOLE (
			12,
			0.0, 0.0,
			0.00001, 0.00001,
			3.8, 15.0,
			0.000016, 0.000063,
			0.0, 9740.0,
			Math.pow(10, 12), 10000*Math.pow(10,12),
			0.05, 0.01, 0.0),  
			//http://en.wikipedia.org/wiki/Stellar_black_hole
	T_TAURI (
			13,
			0.0002, 5.0,
			2000.0, 7600.0,
			0.087, 1.58,
			0.55, 6.5,
			0.2*0.00001, 540.0*0.00001,
			200.0, 10000.0,
			0.0, 0.0, 0.0);  
			//Found in/around nebulas, have high chance of protoplanetary disks.  http://en.wikipedia.org/wiki/T_Tauri_star
	

	

	private final int index;	
	private final double minLum;
	private final double maxLum;
	private final double minTemp;
	private final double maxTemp;
	private final double minMass;
	private final double maxMass;
	private final double minRadius;
	private final double maxRadius;
	private final double minRotate;
	private final double maxRotate;
	private final double minMag;
	private final double maxMag;
	private final double binaryProb;
	private final double trinaryProb;
	private final double quadProb;
	//private final double lifetime;

	public static final EnumSet<EStarType> ALL_STARS = EnumSet.allOf(EStarType.class);
	
	EStarType(int index,			
			double minLum, double maxLum,
			double minTemp, double maxTemp,
			double minMass, double maxMass,
			double minRadius, double maxRadius,
			double minRotate, double maxRotate,
			double minMag, double maxMag, 
			double binaryProb, double trinaryProb, double quadProb)
			//double lifetime)
			{
		this.minLum = minLum;
		this.maxLum = maxLum;
		this.minTemp = minTemp;
		this.maxTemp = maxTemp;
		this.minMass = minMass;
		this.maxMass = maxMass;
		this.minRadius = minRadius;
		this.maxRadius = maxRadius;
		this.minRotate = minRotate;
		this.maxRotate = maxRotate;
		this.minMag = minMag;
		this.maxMag = maxMag;
		this.index = index;
		this.binaryProb = binaryProb;
		this.trinaryProb = trinaryProb;
		this.quadProb = quadProb;
		//this.lifetime = lifetime;
			}

	public double getMinLum() {
		return minLum;
	}

	public double getMaxLum() {
		return maxLum;
	}

	public double getMinTemp() {
		return minTemp;
	}

	public double getMaxTemp() {
		return maxTemp;
	}

	public double getMinMass() {
		return minMass;
	}

	public double getMaxMass() {
		return maxMass;
	}

	public double getMinRadius() {
		return minRadius;
	}

	public double getMaxRadius() {
		return maxRadius;
	}

	public double getMinRotate() {
		return minRotate;
	}

	public double getMaxRotate() {
		return maxRotate;
	}

	public double getMinMag() {
		return minMag;
	}

	public double getMaxMag() {
		return maxMag;
	}
	
	private static final Map<Integer,EStarType> lookup 
    = new HashMap<Integer,EStarType>();

	static {
		for(EStarType s : EnumSet.allOf(EStarType.class))
         lookup.put(s.getIndex(), s);
	}
	
	public int getIndex() { return index; }

    public static EStarType get(int index) { 
         return lookup.get(index); 
    }

	public double getBinaryProb() {
		return binaryProb;
	}

	public double getTrinaryProb() {
		return trinaryProb;
	}

	public double getQuadProb() {
		return quadProb;
	}
	
	public double getNumStars() {
		return 0.0;
	}
	
	

	/*public double getLifetime() {
return lifetime;
}	*/

}
